package com.tim.app.ui.adapter.personal;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.application.library.widget.recycle.BaseRecyclerAdapter;
import com.tim.app.R;
import com.tim.app.server.result.HelpMessageListResult;

import java.util.List;


/**
 * 帮助中心
 */
public class HelpMessageAdapter extends BaseRecyclerAdapter<BaseRecyclerAdapter.BaseRecyclerViewHolder, HelpMessageListResult.Res.Data> {

    private static final String TAG = "HelpMessageAdapter";

    private Context mContext;

    public HelpMessageAdapter(Context mContext, List<HelpMessageListResult.Res.Data> mDataList) {
        super(mDataList);
        this.mContext = mContext;
    }

    @Override
    public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        BaseRecyclerViewHolder holder = null;
        holder = new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.cell_help_message, parent, false));
        return holder;
    }

    @Override
    public void onBindViewHolder(BaseRecyclerViewHolder mHolder, final int position, final HelpMessageListResult.Res.Data data) {
        final ViewHolder holder = (ViewHolder) mHolder;
        if (!TextUtils.isEmpty(data.getProblem())) {
            holder.tvTitle.setText(data.getProblem());
        } else {
            holder.tvTitle.setText("");
        }

    }

    public class ViewHolder extends BaseRecyclerViewHolder {

        TextView tvTitle;

        public ViewHolder(View itemView) {
            super(itemView);
            tvTitle = (TextView) itemView.findViewById(R.id.tvTitle);
        }

    }

}
